public class Test1 {
    public static void main(String[] args) {
        int[] array ={2};
        int val = 3;
        Solution(array,val);
    }

    private static void Solution(int[] array, int val) {
        int j = 0;
            for (int i = 0; i < array.length; i++) {
                if (array[i] != val) {
                    array[j] = array[i];
                    j++;
                }
            }
        for (int i = 0; i < j; i++) {
            System.out.print(" "+array[i]);
        }

    }
}
